import React, { Component } from 'react'

export default class ZhiHuHot extends Component {
    state = {
        news: []
    }
    render() {
        return (
            <ul>
                {
                    this.state.news.map(item => {
                        return <li key={item.target.id}>{item.target.title}</li>
                    })
                }
            </ul>
        )
    }

    getNews = async () => {
        let url = '/api/v3/feed/topstory/hot-lists/total?limit=50&desktop=true';
        //发送 AJAX 请求
        let result = await axios(url);
        //设置
        this.setState({
            news: result.data.data
        })
    }
}
